Conversation
|
@inducer I added a loopy kernel fallback for eager (code), and it's working when the array being multiplied is 1D, but I'm running into some trouble with array strides for higher dimensions. I set up the input array like this: u1 = actx.np.where(actx.np.less_equal(x, (a+b)/2), 0*x + 1, 0*x)
u2 = actx.np.where(actx.np.greater_equal(x, (a+b)/2), 0*x + 1, 0*x)
# u = actx.freeze_thaw(u1) # 1D
u = actx.freeze_thaw(actx.np.stack([u1, u2]).T) # 2DThe strides are no longer C-like after transposing. Lazy doesn't seem to care about this, but eager doesn't like it; it makes my 1D diffusion solver blow up instantly. If I add Edit: I guess the strides of |
|
FWIW, using a dense matrix + |
|
Upon closer inspection, it looks like the kernels may actually be OK. The problem occurs later in the test driver, when I do this: u = actx.freeze_thaw(u + dt*compiled_rhs(t, u))(here |
|
I added some limited support for applying sparse matrices to array containers. Currently it's restricted to the cases of
@inducer I think this is ready for a first look. I still have some FIXMEs scattered throughout the changes for things I could use some input on. |
…_matmul instead of using derived matrix classes
| # FIXME: Not sure if the scipy dependency is OK or if it should just use | ||
| # the call_loopy fallback? Currently getting errors with the loopy version: | ||
| # loopy.diagnostic.LoopyError: One of the kernels in the program has | ||
| # been preprocessed, cannot modify target now. |
There was a problem hiding this comment.
Scipy dep: just fine. Add scipy-stubs to bpr job.
| # FIXME: Not sure if the scipy dependency is OK or if it should just use | ||
| # the call_loopy fallback? Currently getting errors with the loopy version: | ||
| # loopy.diagnostic.LoopyError: One of the kernels in the program has | ||
| # been preprocessed, cannot modify target now. |
There was a problem hiding this comment.
Look up "extra dependencies":
pip install pytato[sparse]
| "iel_ubound", | ||
| shape=(), | ||
| address_space=lp.AddressSpace.GLOBAL, | ||
| # FIXME: Need to do anything with tags? |
Adds a generic interface for operations involving sparse CSR matrices.
cc @lukeolson